package org.dtrd.modules.content.tags.entity.bean;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dtrd.modules.content.tags.entity.po.DtrdExtEmsYwTagCategory;
import org.dtrd.modules.content.tags.entity.po.DtrdExtEmsYwTags;

import java.util.List;

/**
 * @author qr
 * @date 2022/3/16 17:28
 */
@ApiModel(value = "某个标签分组下的所有标签", description = "id = key = value")
@Data
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TagGroupInfo {

    private String key;

    private String value;

    @ApiModelProperty("标签id")
    private String id;

    @ApiModelProperty("名字")
    private String title;

    private boolean selectable = false;

    private List<TagGroupInfo> children;

    public TagGroupInfo parseFromPO(DtrdExtEmsYwTagCategory po) {
        key = ""+po.getDataId();
        value = ""+po.getDataId();
        id = ""+po.getDataId();
        title = ""+po.getCategoryName();
        return this;
    }

    public TagGroupInfo (DtrdExtEmsYwTags po){
        key = ""+po.getDataId();
        value = ""+po.getDataId();
        id = ""+po.getDataId();
        title = ""+po.getTagName();
        selectable = true;
    }
}
